UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

27 lines (20 loc) 731 B
import { fetchRequestHandler } from '@trpc/server/adapters/fetch'; import type { NextRequest } from 'next/server'; import { pino } from '@/libs/logger'; import { createLambdaContext } from '@/libs/trpc/lambda/context'; import { lambdaRouter } from '@/server/routers/lambda'; const handler = (req: NextRequest) => fetchRequestHandler({ /** * @link https://trpc.io/docs/v11/context */ createContext: () => createLambdaContext(req), endpoint: '/trpc/lambda', onError: ({ error, path, type }) => { pino.info(`Error in tRPC handler (lambda) on path: ${path}, type: ${type}`); console.error(error); }, req, router: lambdaRouter, }); export { handler as GET, handler as POST };